home *** CD-ROM | disk | FTP | other *** search
/ Varios Español / Varios Español.iso / DBASE5 / CUA_SAMP.ZIP / SUBMITFM.PRG < prev    next >
Text File  |  1994-10-12  |  2KB  |  44 lines

  1. FUNCTION SubmitFm
  2. PARAMETERS poForm
  3. *----------------------------------------------------------------------------
  4. * NAME
  5. *   SubmitFm - Submit the current record.  If it fails display a message
  6. *              and return .F.
  7. *
  8. * PARAMETERS
  9. *   poForm     = Object reference to the form
  10. *
  11. *----------------------------------------------------------------------------
  12.     PRIVATE cIntlTry, lOk
  13.  
  14.     cIntlTry = [Imposible escribir el registro. Vuelva a intentarlo o cancele la ficha.]
  15.     lOk      = .T.
  16.  
  17.     *--------------------------------------------------------
  18.     *-- Make sure this is a form object before doing anything
  19.     *--------------------------------------------------------
  20.     IF TYPE( "poForm.Classname" ) = "C" .AND. poForm.Classname = "FORM"
  21.  
  22.         *-----------------------------------------------------------------
  23.         *-- If current record was modified, write it, otherwise do nothing
  24.         *-----------------------------------------------------------------
  25.         IF poForm.Modified()
  26.  
  27.             lOk = poForm.Submit()
  28.  
  29.             *---------------------------------------------------------------
  30.             *-- Display an information message if Submit() failed.  Submit()
  31.             *-- can fail a number of ways.  For instance, if the record
  32.             *-- lock failed before writing, Submit() returns false.
  33.             *-- Submit() also fails if an event handler closed the database
  34.             *-- for the form.
  35.             *---------------------------------------------------------------
  36.             IF .NOT. lOk
  37.                 DO InfoMsg WITH m->cIntlTry
  38.             ENDIF
  39.         ENDIF
  40.     ENDIF
  41.  
  42. RETURN lOk
  43. *-- EOP: SubmitFm WITH poForm
  44.